# Options
options(stringsAsFactors = FALSE)
# Packages
library(foreign)
library(magrittr)
# Zip codes for which we have weather
weather_zips <- "S:/Edward/Salience/DataWeather/ZipIntraBillWeather" %>% dir()
weather_zips <- gsub("weather_intra_bill_zip_", "", weather_zips)
weather_zips <- gsub(".dta", "", weather_zips)
# PGE file list
pge_zips <- "S:/Edward/UtilityZipcode/PGE" %>% dir()
pge_zips <- gsub("pge_", "", pge_zips)
pge_zips <- gsub("\\.dta", "", pge_zips)
pge_zips <- intersect(pge_zips, weather_zips)
# SDGE file list
sdge_zips <- "S:/Edward/UtilityZipcode/SDGE" %>% dir()
sdge_zips <- gsub("sdge_", "", sdge_zips)
sdge_zips <- gsub("\\.dta", "", sdge_zips)
sdge_zips <- intersect(sdge_zips, weather_zips)
# So Cal file list
socal_zips <- "S:/Edward/UtilityZipcode/SoCal" %>% dir()
socal_zips <- gsub("socal_", "", socal_zips)
socal_zips <- gsub("\\.dta", "", socal_zips)
socal_zips <- intersect(socal_zips, weather_zips)
# Save the file lists
write.dta(dataframe = data.frame(zip = pge_zips),
  file = "S:/Edward/UtilityZipcode/pge_zipcodes.dta",
  version = 10)
write.dta(dataframe = data.frame(zip = sdge_zips),
  file = "S:/Edward/UtilityZipcode/sdge_zipcodes.dta",
  version = 10)
write.dta(dataframe = data.frame(zip = socal_zips),
  file = "S:/Edward/UtilityZipcode/socal_zipcodes.dta",
  version = 10)
